package com.zhu.mapper;

import com.zhu.pojo.Organization;
import com.zhu.pojo.Person;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PersonMapper {
    @Select("select * from personnel where name=#{name}")
    public List<Person> search(String name);

    @Insert("insert into personnel (name,account,position,phone,email,region_id) values (#{name},#{account},#{position},#{phone},#{email},#{region_id})")
    public void personadd(Person person);

    @Select("select * from organization where parent_id=#{id}")
    public List<Organization> getlist(int id);

    @Select("select * from personnel where name=#{name}")
    public Person searchByName(String name);

    @Update("update personnel set account=#{account},position=#{position},phone=#{phone},email=#{email},region_id=#{region_id} where name=#{name}")
    public void update(Person person);

    @Select("select * from personnel where account=#{account}")
    public Person searchOne(String account);

    @Delete("delete from personnel where account=#{account}")
    public void delete(String account);
}
